#ifndef DRAW_H
#define DRAW_H

// 3rd, how about copy paste
#include "termbox.h"
// own
#include "inputs.h"
#include <cstdint>

struct box
{
  using u32 = uint32_t;
  u32 left_up;
  u32 left_down;
  u32 right_up;
  u32 right_down;

  u32 top;
  u32 bot;
  u32 left;
  u32 right;
};

struct matrix_dot
{
  int val;
  bool is_head;
};

struct matrix_state
{
  struct matrix_dot** grid;
  int* length;
  int* spaces;
  int* updates;
};

struct doom_state
{
  uint8_t* buf;
};

union anim_state 
{
  struct doom_state* doom;
  struct matrix_state* matrix;
};

struct term_buf{
  using u16 = uint16_t;
  u16 length;
  u16 height;
  u16 init_width;
  u16 init_height;

  struct box box_chars;
  char* info_line;
  u16 labels_max_len;
  u16 box_x;
  u16 box_y;
  u16 box_width;
  u16 box_height;

  union anim_state astate;
};

void draw_init(struct term_buf* buf);
void draw_free(struct term_buf* buf);
void draw_box(struct term_buf* buf);

struct tb_cell* strn_cell(char* s, uint16_t len);
struct tb_cell* str_cell(char* s);
// TODO:
#endif
